import React, { useEffect } from 'react'
import { StyleSheet, Image, StatusBar, View } from 'react-native'

const Splash = ({ navigation }) => {

    useEffect(() => {
        setTimeout(() => {
            // replace: 销毁当前页，跳转到下一个页面
            navigation.replace('Index')
        }, 5000)
    }, [navigation])

    return (
        <View style={styles.splash}>
            <StatusBar hidden={true} />
            <Image source={require('../images/splash.jpg')} />
        </View>
    )
}

export default Splash

const styles = StyleSheet.create({
    splash: {
        flex: 1,
        alignItems: 'center',
        justifyContent: 'center',
        backgroundColor: '#1C0E1B',
    }
})
